package chapter04

import "github.com/gin-gonic/gin"

func Router(chap04 *gin.RouterGroup) {
	// form数据绑定
	chap04.GET("/to_bind_form", ToBindForm)
	chap04.POST("do_bind_form", DoBindForm)

	// query_string数据绑定, 这个数据类型，是获取路由上url的参数值
	// http://localhost:9000/bind_query_string?name=vick&age=18&addr=xxxxx
	chap04.GET("/bind_query_string", BindQueryString)

	// json数据绑定
	chap04.GET("/to_bind_json", ToBindJion)
	chap04.POST("do_bind_json", DoBindJson)

	// uri数据绑定
	// http://localhost:9000/bind_uri/hell/19/xxx
	chap04.GET("/bind_uri/:name/:age/:addr", BindUri)

	// 数据校验
	chap04.GET("/to_valid", ToValidData)
	chap04.POST("/do_valid", DoValidData)
}
